//
//  NotifViewController.swift
//  Swift各种传值
//
//  Created by Bao on 15/12/10.
//  Copyright © 2015年 Microlink. All rights reserved.
//

import UIKit

class NotifViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.whiteColor()
        self.title = "通知传值"
        
        let btn:UIButton? = UIButton(type: .Custom)
        btn?.frame = CGRectMake(60, 70, 100, 50)
        btn?.backgroundColor = UIColor.redColor()
        btn?.setTitle("改变title", forState:.Normal)
        btn?.addTarget(self, action: Selector("greetings"), forControlEvents: .TouchUpInside)
        self.view .addSubview(btn!)
        // Do any additional setup after loading the view.
    }
    func greetings(){
//        let notic:NSNotificationCenter? = NSNotificationCenter()
//        let noti:NSNotification? = NSNotification(name: "noti", object: "通知传值", userInfo: nil)
//        notic?.postNotification(noti!)
        
    NSNotificationCenter.defaultCenter().postNotificationName("noti", object: "通知传值")
    
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
